// 防止提交按钮重复提交
export default {
  install(Vue) {
    Vue.directive("preventReClick", {
      bind: async function(el, binding) {
        el.addEventListener("click", () => {
          if (!el.disabled) {
            el.disabled = true;
            setTimeout(() => {
              el.disabled = false;
            }, binding.value || 3500);//默认设置重复提交时间3.5秒
          }
        });
      }
    });
  }
};
